import React from 'react'
import ReactDOM from 'react-dom/client'
import { createBrowserRouter, RouterProvider } from 'react-router-dom'

//引入一个方法和一个组件
// createBrowserRouter--用来创建路由实例，在方法中定义路由path和组件的对应关系
// RouterProvider--作为一个组件渲染，并且传入createBrowserRouter执行后生成的router实例

const router = createBrowserRouter([
  {
    path: '/',
    element: <div>this is layout</div>
  },
  {
    path: '/login',
    element: <div>this is login</div>
  },
  {
    path: '/about',
    element: <div>this is about</div>
  }
])

ReactDOM.createRoot(document.getElementById('root')).render(
  <React.StrictMode>
    <RouterProvider router={router} />
  </React.StrictMode>
)
